var HtmlWebpackPlugin = require('html-webpack-plugin');
var pageMap = require('./src/map');
var path = require('path');


var asArr = {};
var htmlArr = [];
var maps = pageMap;
for (var keys in maps) {
	if (maps[keys].build) {
		htmlArr.push(
			new HtmlWebpackPlugin({
				filename: `${keys}.html`,
				title: maps[keys].title,
				// template: path.join(__dirname, "./src/routes", keys, maps[keys].tpl),
				template: path.join(__dirname, "./src/index.html"),
				cache: false,
				inject: 'body',
				chunks: [`${keys}`],
				minify: {
					removeComments: false,
					collapseWhitespace: false
				}
			})
		);

		asArr[keys] = path.join(__dirname, `./src/routes/${keys}/index.js`)
		// asArr[keys] = path.join(__dirname, `./src/routes/${keys}/index.js`, keys, maps[keys].src)
	}
}

//配置html
module.exports.html = htmlArr;

//配置静态资源
module.exports.entry = asArr;
